﻿<div class="rz-p-12 rz-text-align-center">
    <RadzenDatePicker @bind-Value=@value ParseInput="@ParseDate" />
</div>

@code {
    DateTime? value = DateTime.Now;

    public DateTime? ParseDate(string input)
    {
        string[] formats = { "dd-MM-yyyy", "dd/MM/yyyy", "dd-MM-yy", "dd/MM/yy", "ddMMyyyy", "ddMMyy", "dd-MM", "dd/MM", "ddMM" };

        foreach (var format in formats)
        {
            if (DateTime.TryParseExact(input, format, null, System.Globalization.DateTimeStyles.None, out var result))
            {
                return result;
            }
        }

        return null;
    }
}